package com.example.obj;

import java.util.ArrayList;
import java.util.List;

public class FolderList {
	
	private List<String> Folders;
	
	public FolderList(){
		Folders = new ArrayList<String>();
	}
	
	public FolderList(List<String> folders){
		Folders = new ArrayList<String>(folders);
	}
	
	public List<String> getFolders() {
		return Folders;
	}

	public void setFolders(List<String> folders) {
		Folders = folders;
	}
	
	@Override
	public String toString() {
		return "" + Folders + "";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((Folders == null) ? 0 : Folders.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		FolderList other = (FolderList) obj;
		if (Folders == null) {
			if (other.Folders != null)
				return false;
		} else if (!Folders.equals(other.Folders))
			return false;
		return true;
	}

	public FolderList without(String folder) {
		FolderList folderList = new FolderList(Folders);
		folderList.remove(folder);
		return folderList;	
	}
	
	public FolderList remove(String folder) {
		Folders.remove(folder);
		return this;		
	}

	public FolderList with(String folder) {
		FolderList folderList = new FolderList(Folders);
		folderList.add(folder);
		return folderList;	
	}

	public FolderList add(String folder) {
		Folders.add(folder);
		return this;			
	}

	public int size() {		
		return Folders.size();
	}

	public String get(int i) {		
		return Folders.get(i);
	}
}
